package com.metel.mservice.common.listener;

import javax.servlet.ServletContextEvent;

import org.springframework.web.util.Log4jConfigListener;

import com.metel.mservice.common.context.OpenAPIContext;
import com.metel.mservice.common.context.OpenAPIContextManager;

/**
 * Custom Log4jConfigListener
 * 
 * @author sr80.choi
 */
public class OpenAPILog4jConfigListener extends Log4jConfigListener {

	@Override
	public void contextInitialized(ServletContextEvent event) {
		OpenAPIContext context = OpenAPIContextManager.getContext();

		if(context.isProductionContext()) {
			super.contextInitialized(event);
		} else {
			context.initializeWebLogger(event.getServletContext());
		}
	}
}
